From: Philip Withnall Date: Mon, 7 Aug 2017 13:09:07 +0000 (+0100) Subject: lib/repo-commit: Drop unreachable conditional branch X-Git-Tag: archive/raspbian/2022.1-3+rpi1~1^2~4^2~33^2~30 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:///%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:/?a=commitdiff_plain;h=4f187b576dc58d725757070148c824916d3c3aa7;p=ostree.git lib/repo-commit: Drop unreachable conditional branch (remaining > 0) is asserted by the loop condition, and remaining is not modified between that check and the G_UNLIKELY — so the condition in the G_UNLIKELY will always be true. Spotted by Coverity as issue #1452617. Signed-off-by: Philip Withnall Closes: #1059 Approved by: cgwalters --- diff --git a/src/libostree/ostree-repo-commit.c b/src/libostree/ostree-repo-commit.c index dc52f5e7..72961dde 100644 --- a/src/libostree/ostree-repo-commit.c +++ b/src/libostree/ostree-repo-commit.c @@ -486,12 +486,7 @@ create_regular_tmpfile_linkable_with_content (OstreeRepo *self, if (bytes_read < 0) return FALSE; else if (bytes_read == 0) - { - if (G_UNLIKELY (remaining > 0)) - return glnx_throw (error, "Unexpected EOF with %" G_GUINT64_FORMAT "/%" G_GUINT64_FORMAT " bytes remaining", remaining, length); - else - break; - } + return glnx_throw (error, "Unexpected EOF with %" G_GUINT64_FORMAT "/%" G_GUINT64_FORMAT " bytes remaining", remaining, length); if (glnx_loop_write (tmpf.fd, buf, bytes_read) < 0) return glnx_throw_errno_prefix (error, "write"); remaining -= bytes_read;